<h1><%= link_to "Créer un nouveau client", new_client_path %></h1>
<br>
<br>
<h2>Rechercher un client par son nom.</h2>

<% form_tag clients_path, :method => :get do %>
<p>
    <%= text_field_tag :search, params[:search] %>
    <%= submit_tag "Chercher" %>
</p>
<% end %>

<h2>Listing clients</h2>

<table>
  <tr>
    <th>Civilité</th>
    <th>Nom</th>
    <th>Prenom</th>
    <th>Ch. préférée</th>
    <th>Information</th>
    <th>Date dernier sejour</th>
    <th>Total sejours</th>
  </tr>

<% for client in @clients %>
  <tr>
		<td><%= h client.civilite %></td>
    <td><strong><%= link_to (h client.nom), client %></strong></td>
    <td><%= h client.prenom %></td>
		<td><%=h client.ch_preferee %></td>
    <td><stong><%= link_to (h client.info_additionnelle), edit_client_path(client) %></strong></td>
    <td><%=h client.date_dernier_sejour %></td>
    <td><%=h client.total_sejours %></td>
    <td><%= link_to 'Show', client %></td>
    <td><%= link_to 'Edit', edit_client_path(client) %></td>
    <td><%= link_to 'Destroy', client, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />
<%= link_to 'Back', :controller => "reservations", :action => "new" %>

